﻿<!--BitAdmin2.0框架文件-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>BitAdminCore-消息推送示例</title>
    <meta name="description" content="BitAdminCore, Version 1.0, Alpha" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <link href="../../lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="../../lib/jquery/jquery.min.js"></script>
    <script src="../../lib/bootstrap/js/bootstrap.min.js"></script>

    <style>
        h4{
            font-weight:bold;
        }
        .row {
            margin: 5px;
        }

        .btn {
            width: 150px;
        }
    </style>
</head>
<body>
    <div class="col-md-6">
        <div class="row">
            <h4>推送电子邮件：</h4>
            发送邮件到你自己的邮箱。
        </div>
        <div class="row">
            <a href="javascript:sendEmail();" class="btn btn-success">发送电子邮件</a>
        </div>
        <hr />
        <div class="row">
            <h4>推送WebSocket消息：</h4>
            通过WebSocket方式推送消息到网页，可改造为聊天功能。
        </div>
        <div class="row">
            <a href="javascript:pushWebSocket();" class="btn btn-success">服务端推送</a>
            <a href="javascript:sendWebSocket();" class="btn btn-success">客户端发送</a>
        </div>
        <hr />
        <div class="row">
            <h4>推送微信公众号消息：</h4>
            先扫二维码关注公众号，再向自己推送一条消息。<br />
            <img width="150" src="http://mmbiz.qpic.cn/mmbiz_jpg/sicib7WeTSmgW8wCM7UwhkiaZiaC35RyHibQ478zmJW3noqlo5I0GYuIhhNC37Xnb0H1DdVNWkdNtziakc2rpJjEXDug/0" />
        </div>
        <div class="row">
            <a href="javascript:sendWeixinMP();" class="btn btn-success">推送公众号消息</a>
        </div>
        <hr />
        <div class="row">
            <h4>推送微信企业号消息：</h4>
            先扫二维码加入企业，再向自己推送一条消息。<br />
            <img width="150" src="https://work.weixin.qq.com/wework_admin/genqrcode?action=join&vcode=2d116dc3ab70036bc23d1de6e0436166&r=hb_share_mng_contacts" />
        </div>
        <div class="row">
            <a href="javascript:sendWeixinWork();" class="btn btn-success">推送企业号消息</a>
        </div>
        <hr />
        <div class="row">
            <h4>推送个推平台消息：</h4>
            通过个推平台向手机App推送消息。先绑定当前用户的clientId。
        </div>
        <div class="row">
            <a href="javascript:bindClientId();" class="btn btn-primary">绑定clientId</a>
            <a href="javascript:pushIgetui();" class="btn btn-success">推送个推消息</a>
        </div>
        <hr />
    </div>
    <div class="col-md-6">

        <div class="row">
            <h4>生成二维码示例：</h4>
            扫描可以下载框架安卓App。
        </div>
        <div class="row">
            <img src="../../qrcode/encode?msg=https%3a%2f%2fwww.bitadmincore.com%2fapps%2fBitAdminCore_1.0.3.apk" width="100" height="100" />
        </div>
    </div>
    <div class="col-md-12" style="height:50px;"></div>
    <div class="col-md-12">
        <div class="row">
            <h4>WebSocket在线连接详细信息：</h4>
            提供WebSocket服务器信息，用户在线信息。<br />
            <a href="javascript:online();" class="btn btn-success">刷新连接信息</a>
        </div>
        <div class="row">
            <table class="table">
                <thead><tr><th>服务器</th><th>心跳时间</th></tr></thead>
                <tbody class="server"></tbody>
            </table>
            <table class="table">
                <thead><tr><th>ID</th><th>远程</th><th>打开</th><th>远程IP</th><th>心跳时间</th></tr></thead>
                <tbody class="socket"></tbody>
            </table>
        </div>
        <div class="row">
        </div>
    </div>
    <!--cnzz统计代码，可以移除，开始-->
    <div style="display:none;">
        <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cspan id='cnzz_stat_icon_1263497164'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s22.cnzz.com/z_stat.php%3Fid%3D1263497164%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script>
    </div>
    <!--cnzz统计代码，可以移除，结束-->
    <script src="../../js/framework/BitAdmin.js"></script>
    <script>
        function pushWebSocket() {
            $.get("../../readme/noticWebSocket", function (result) { }); return false;
        }
        function sendWebSocket() {
            window.parent.BitNoticeService.sendChat("5eeea4ce-71ab-4464-b72f-17f5163ee944", "随机数：" + Math.random());
        }
        function sendEmail() {
            var email = window.prompt("请输入你的电子邮箱地址");
            $.get("../../readme/noticEmail", { email: email }, function (result) { }); return false;
        }
        function pushIgetui() {
            $.get("../../readme/noticIgetui", function (result) { }); return false;
        }
        function bindClientId() {
            var cid = window.prompt("请输入clientId");
            $.get("../../account/bindClientId", { clientId: cid, userId: "" }, function (result) { }); return false;
        }
        function sendWeixinMP() {
            var userCode = window.prompt("请输入你的OpenId");
            $.get("../../readme/noticWeixinMP", { userCode: userCode }, function (result) { }); return false;
        }
        function sendWeixinWork() {
            var userCode = window.prompt("请输入你的账号");
            $.get("../../readme/noticWeixinWork", { userCode: userCode }, function (result) { }); return false;
        }

        function online() {
            $.get("../../bitservice/online", function (result) {
                var server = $(".server");
                server.empty();
                for (var name in result.server) {
                    server.append('<tr><td>' + name + '</td><td>' + time.format(result.server[name], "yyyy-MM-dd HH:mm:ss") + '</td></tr>');
                }

                var socket = $(".socket");
                socket.empty();
                $.each(result.sockets, function (index, val) {
                    socket.append('<tr><td>' + val["UserId"] + '</td><td>' + val["IsRemote"] + '</td><td>' + val["IsOpen"] + '</td><td>' + val["RemoteIp"] + '</td><td>' + val["RemoteTime"] + '</td></tr>');
                });
            }); return false;
        }
        online();
    </script>
</body>
</html>